/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.sql.Time;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import util.enumeration.OperatingHours;

/**
 *
 * @author KohLi
 */
@Entity(name="EventTime")
public class EventTimeEntity implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date startDate; 

    @Temporal(javax.persistence.TemporalType.DATE)
    private Date endDate; 
    
    private OperatingHours openingHoursEnum;
    private OperatingHours closingHoursEnum;
    
    @OneToOne
    private EventEntity event;
    
     public EventTimeEntity() {
    }

    public EventTimeEntity(EventTimeEntity operatingHoursEntity) {
        this.startDate = operatingHoursEntity.getStartDate();
        this.endDate = operatingHoursEntity.getEndDate();
        this.openingHoursEnum = operatingHoursEntity.getOpeningHoursEnum();
        this.closingHoursEnum = operatingHoursEntity.getClosingHoursEnum();
    }
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EventTimeEntity)) {
            return false;
        }
        EventTimeEntity other = (EventTimeEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.EventTime[ id=" + id + " ]";
    }

    /**
     * @return the closingHoursEnum
     */
    public OperatingHours getClosingHoursEnum() {
        return closingHoursEnum;
    }

    /**
     * @param closingHoursEnum the closingHoursEnum to set
     */
    public void setClosingHoursEnum(OperatingHours closingHoursEnum) {
        this.closingHoursEnum = closingHoursEnum;
    }
 
    /**
     * @return the openingHoursEnum
     */
    public OperatingHours getOpeningHoursEnum() {
        return openingHoursEnum;
    }

    /**
     * @param openingHoursEnum the openingHoursEnum to set
     */
    public void setOpeningHoursEnum(OperatingHours openingHoursEnum) {
        this.openingHoursEnum = openingHoursEnum;
    }

    /**
     * @return the event
     */
    public EventEntity getEvent() {
        return event;
    }

    /**
     * @param event the event to set
     */
    public void setEvent(EventEntity event) {
        this.event = event;
    }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
    
}
